﻿@model BBICMS.Model.LinkCategory
@{
    ViewBag.Title = "编辑分类";
    ViewBag.PageTitle = ViewBag.Title + "_组件";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
    var options = new AjaxOptions()
    {
        Url = Url.Action("EditCategory", "Link"),
        LoadingElementId = "saving",
        LoadingElementDuration = 2000,
        //   Confirm = "Are you sure you want to save this User?"
        OnSuccess = "updateSuccess"

    };
}




<div class="main-content">


    <div class="panel panel-default">
        <header class="panel-heading">
            <i class="glyphicon glyphicon-edit"></i> @ViewBag.Title

        </header>

        <section class="panel-body">

            @using (Ajax.BeginForm("EditCategory", null, options, new { @class = "form-horizontal", role = "form" }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)


                @Html.HiddenFor(model => model.Id)
                @Html.HiddenFor(model => model.AddedBy)
                @Html.HiddenFor(model => model.AddedDate)
                @Html.HiddenFor(model => model.UpdatedBy)
                @Html.HiddenFor(model => model.UpdatedDate)

                <div class="form-group">
                    @Html.LabelFor(model => model.Title, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.Title, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Title, ViewData).Watermark })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Title)
                    </div>
                </div>

             

                <div class="form-group">
                    @Html.LabelFor(model => model.Importance, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.Importance, new { @class = "form-control", type = "number", placeholder = "排序" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Importance)
                    </div>

                </div>




                <div class="form-group">

                    <div class="col-md-5 col-md-offset-2">
                        <div class="checkbox">
                            <label>
                                @Html.CheckBoxFor(model => model.Active)  @Html.DisplayNameFor(model => model.Active)
                            </label>
                        </div>

                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Active)
                    </div>

                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-md-10">
                        <input type="submit" class="btn btn-primary" value="保存" /> <a href="@Url.Action("Categories","Link")" class="btn btn-default"><span class="glyphicon glyphicon-arrow-left"></span> 返回</a>
                    </div>
                </div>

            }

        </section>


    </div>

</div>



@section Footer {
    @Scripts.Render("~/bundles/jqueryval")
    <script>
    function updateSuccess(data) {

        //  console.log(data.Oicq);
        toastr.options = {
            "positionClass": "toast-bottom-full-width"
        }
        if (data) {
            toastr.success('分类已更新成功！', '@ViewBag.Title')
        } else {
            toastr.error('分类更新失败！', '@ViewBag.Title')
        }
    }
    $(function () {


        //当前菜单
        //$('.mainmenu>li:nth-of-type(2)').addClass('nav-open');
    });

    </script>
}
